﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>短信管理</title>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />

    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/Base/BaseClass.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/JqueryPlug/layer/layer/layer.js"></script>
    <script src="/Scripts/avalon.min.js"></script>
    <script src="/Scripts/SZHLCommon.js"></script>
    <script>
        var model = avalon.define({
            $id: "APP_DXGL",
            modelData: { "dxContent": "", "dxnums": "", "SendTime": "" },
            SaveData: function (dom) {
                var errmsg = "";
                if ($(".szhl_require")) {
                    $(".szhl_require").each(function () {
                        if ($(this).val() == "") {
                            errmsg = $(this).parent().find("label").text() + "不能为空\r\n";
                        }
                    })
                }
                if (errmsg !== "") {
                    layer.tips(errmsg, dom);
                } else {
                    if ($("input[type=checkbox]").prop("checked") && model.modelData.SendTime == "")
                    {
                        layer.tips("发送时间不能为空", dom);
                        return;
                    }
                    var modelValue = JSON.stringify(model.modelData.$model);
                    $.post('/API/FTAPI.ashx?Action=ADDDXGL', { "P1": modelValue }, function (result) {
                        var result = $.parseJSON(result);
                        if (result.ErrorMsg == "") {
                            parent.ComFunJS.winsuccess("发送成功");
                        } else {

                            parent.ComFunJS.winsuccess("发送失败");
                        }
                    })
                }
            }
        });
        $(function () {
            ComFunJS.initForm();
            $("input[type=checkbox]").click(function () {
                $(".szhl_form_date_time").toggle();
                if (!$("input[type=checkbox]").prop("checked")) {
                    model.modelData.SendTime = "";
                    $("button[type=button]").text("立即发送") 
                } else {
                    $("button[type=button]").text("定时发送")
                }
            })
        })
    </script>
</head>
<body ms-controller="APP_DXGL">
    <div class="container-fluid maindiv" style="margin-top: 20px" id="dvContent">
        <div style="width:200px;position:absolute">
            <div class="list-group ">
                <a href="/View/APPBaseView/APP_DXGL.html" class="list-group-item active" style="padding-left: 15px"><span class="glyphicon glyphicon-list"></span>&nbsp;&nbsp;发送短信</a>
                <a href="/View/APPBaseView/APP_DXGL_List.html" class="list-group-item" style="padding-left: 15px"><span class="glyphicon glyphicon-list"></span>&nbsp;&nbsp;已发短信</a>
            </div>
        </div>
        <div class="row contentdv" style="margin-left:201px">
            <div class="col-xs-12 ">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="form-group">
                            <label>短信接收号码</label>
                            <textarea class="form-control szhl_require" ms-duplex="modelData.dxnums"></textarea>
                            <a href="#">+从员工中选取号码</a>                            <a href="#" style="margin-left: 20px">+从客户列表中选取号码</a>
                        </div>
                        <div class="form-group">
                            <label>短信内容（不超过80字）</label>
                            <textarea class="form-control szhl_require"  ms-duplex="modelData.dxContent"></textarea>
                        </div>
                        <div class="checkbox">
                            <label>
                                <input type="checkbox">
                                定时发送
                            </label>
                            <input type="text" value="" ms-duplex="modelData.SendTime" class="szhl_form_date_time form-control" style="display:none;" placeholder="请输入发送时间" />
                        </div>
                        <button type="button" class="btn btn-default" ms-click="SaveData(this)">立即发送</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
</body>
</html>
